home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 921 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.8 KB

  1. Path: cs.mu.OZ.AU!bounce-back
  2. From: abell@mindspring.com (Andrew Bell)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Quick questions (but no longer so quick)
  5. Date: 01 Apr 96 04:19:13 GMT
  6. Organization: MindSpring Enterprises
  7. Approved: fjh@cs.mu.oz.au
  8. Message-ID: <4jnip5$916@mule2.mindspring.com>
  9. References: <4jajk2$17aq@mule1.mindspring.com> <4jbto7$78i@engnews1.Eng.Sun.COM>
  10. NNTP-Posting-Host: mundook.cs.mu.oz.au
  11. X-Original-Date: Mon, 01 Apr 1996 03:35:21 GMT
  12. X-Newsreader: Forte Agent .99.82
  13. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  14.     iQBFAgUBMV9ZUuEDnX0m9pzZAQH4LgF/euNNu8ioaEqnl1mvifjNV+TNGtb7PqWD
  15.     EEJeFb//eNBrHnE52qNuMalc0I73+v6/
  16.     =Oh09
  17. Originator: fjh@mundook.cs.mu.OZ.AU
  18.  
  19. clamage@Eng.Sun.COM (Steve Clamage) wrote:
  20. >C++ implementations don't exist in a vacuum. They
  21. >have to coexist with platform ABIs (Application Binary Interface, the
  22. >bit-level description of data and function calls). It is common for an ABI
  23. >to specify rules for structured types that are different from the rules
  24. >for simple types, no matter what the contents of the structure. 
  25.  
  26. But where would our example [ class Short { int short; }; ] ever need
  27. to appear as anything other than a short, save within the C++ program
  28. itself?  
  29.  
  30. >Either the generated code is incompatible with system and 3rd-party
  31. >libraries, or the compiler violates the C++ standard.
  32.  
  33. Given that name-mangling isn't standard or consistent from compiler to
  34. compiler, unless you have a library created by that same compiler
  35. (that would thus realize the alignment would be as per short), when
  36. would this matter?  The only case I can think of is for SOM or some
  37. other system-level object modelling proposal.
  38.  
  39. Is what I want to do (add member funcs to an already-defined class),
  40. and have some way to define conversion operators from the old class to
  41. the new such a rare concept?  Seems like I read a lot about the
  42. conflict between adding lots of functions to a class and keeping it
  43. simple and usable, and having support for wrappers would be a possible
  44. way to deal with this.
  45.  
  46. Say:
  47.  
  48. wrapper new_class : <public,protected,private> base_class
  49. {
  50.     ...
  51. };
  52.  
  53. Wrappers could not have new member variables, virtual functions of any
  54. kind, or more than one base class.  Conversion from a wrapper to the
  55. base would be automatic.  It would need some way to define conversions
  56. the other way (the new_class member funcs might not apply to all
  57. base_class objs, just some of them).
  58.  
  59. Andrew Bell
  60. abell@mindspring.com
  61. ---
  62. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  63. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  64. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  65. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  66. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  67.